Skip to content

V3 Phase 4: multi-platform export + caption generator + font presets#13

Merged
maxazure merged 1 commit into
mainfrom
v3-phase-4-cover-multi-caption
May 16, 2026
Merged

V3 Phase 4: multi-platform export + caption generator + font presets#13
maxazure merged 1 commit into
mainfrom
v3-phase-4-cover-multi-caption

Conversation

@maxazure

Copy link
Copy Markdown
Owner

Closes part of #10.

What this PR adds

Script Job
multi_export.py One master video → three platform-specific deliverables (xhs 3:4 / douyin 9:16 / wxch ≤60s)
generate_caption.py Rule-based note body: title + 200-500 char body + 3-6 tags + publish-time hint
profiles/_fonts.yaml Five title-font presets (tech_ai / data_review / warm_lifestyle / business_serious / food_youth)

multi_export.py

Smart aspect filter selects between scale-only, centre-crop top/bottom, or centre-crop sides depending on source vs target ratio. -movflags +faststart on every output. wxch preset auto-truncates at 60s for 视频号 social-graph distribution.

generate_caption.py

No LLM dependency — pure rule-based. TF-IDF keyword extraction (with CJK stopwords), title synthesis from hook or top keywords, emoji-paced body, tag generation that mixes 垂类 + 长尾 (avoids the pure-hot-tag spam pattern that flags搬运).

Output is run through content_guard.enforce() so any caption that trips a hard rule (diversion, extreme words, medical claims, wealth bait) is rejected at generation time.

Tests

+21 new (multi_export aspect/cmd build, caption synthesis + guard integration, font preset). Full suite: 130 passing.

Test plan

  • pytest tests/ green
  • python3 scripts/generate_caption.py --script day58/work/clean_script.md --profile tech_pro returns a sensible title + 200-500 char body
  • python3 scripts/multi_export.py <in.mp4> --output-dir /tmp/out --platforms xhs douyin wxch --dry-run prints three ffmpeg invocations
  • Manual: run multi_export on the day58 master and verify the xhs output is 1080×1440 with centre-cropped content

…presets

scripts/multi_export.py
  Three platform presets (xhs 3:4 1080×1440, douyin 9:16, wxch ≤60s).
  Smart aspect filter: scale when ratios match, centre-crop top/bottom
  when source is taller than target, centre-crop sides when wider.
  -movflags +faststart on every output. wxch auto-truncates at 60s.

scripts/generate_caption.py
  Rule-based caption (note body) generator. No LLM dep.
  - TF-IDF-ish keyword extraction (stopword-filtered)
  - Title ≤18 chars, surfaces 2 keywords in front 18 chars
  - Body 200-500 chars with emoji every ~60 chars from 8-emoji palette
  - 3-6 # tags from keywords (mix垂类+长尾, no pure hot-tag spam)
  - Publish-time hint sourced from audience profile
  - All output passes through the content guard

scripts/profiles/_fonts.yaml
  Five title-font presets: tech_ai (Smiley Sans), data_review (阿里妈
  妈数黑体), warm_lifestyle (阿里妈妈方圆体), business_serious (思源
  Heavy), food_youth (奶酪体). Underscore prefix so list_profiles()
  doesn't enumerate it as an audience profile.

scripts/profiles/__init__.py
  - load_profile() / list_profiles() skip underscore-prefixed files
  - load_fonts_preset() resolves a font intent to a primary + fallbacks

Tests: +21 (10 multi-export aspect/cmd, 10 caption synthesis + guard
integration, 1 font preset). Full suite: 130 passing.
Copilot AI review requested due to automatic review settings May 16, 2026 23:36
@maxazure maxazure merged commit 7ff0208 into main May 16, 2026
@maxazure maxazure deleted the v3-phase-4-cover-multi-caption branch May 16, 2026 23:36
@maxazure maxazure removed the request for review from Copilot May 16, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant